<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 

<h:head>
	<title>Feedbackmodul - UmfrageEcke -</title>
	<link rel="stylesheet" type="text/css" href="../css/styles.css"></link>
	<link rel="stylesheet" type="text/css" href="../css/start.css"></link>
	<link rel="stylesheet" type="text/css" href="../css/umfrage_table.css"></link>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
</h:head> 
<h:body >
	<a4j:outputPanel styleClass="headerMenu" id="headerMenu">
	<h:form id="headermenueForm">
		<table id="header_table" class="HeaderMenuTable">
			<tr>
				<td><h:commandLink id="AdministrationShow_B" action="#{GenericSurveySessionBean.gotoSurveyAdministration()}" value="zur Administration" target="_blank"></h:commandLink></td>
			</tr>
		</table>
		</h:form>
	</a4j:outputPanel>
	
	<h:form id="login_form">
    <rich:panel styleClass="loginPanel" id="loginPanel" rendered="#{GenericSurveySessionBean.showLogin}">
        <f:facet name="header">
        <center>Login - zur Umfrage -</center>
        </f:facet>
        <table id="login_table" class="LoginTable">
        	<tr>
        		<td><h:outputText value="Name: " /> </td>
        		<td><h:inputText id="name_input" value="#{GenericSurveySessionBean.loginname}"/></td>
        	</tr>
        	<tr>
        		<td><h:outputText value="Passwort: " /> </td>
        		<td><h:inputSecret id="passwort_input" value="#{GenericSurveySessionBean.loginpasswort}"/></td>
        	</tr>
        	<tr>
        		<td colspan="2"><hr width="90%"/></td>
        	</tr>
        	<tr>
        		<td colspan="2">
        			<center>
        			<a4j:commandButton action="#{GenericSurveySessionBean.loginParticipant()}" value="login" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" execute="login_form" render="Messagespopup,tan_form,login_form,umfrage_d_form"/>
        			</center>
        		</td>
        	</tr>
        </table>
	</rich:panel>
	</h:form>
	
	<h:form id="tan_form">
    <rich:panel styleClass="loginPanel" id="TanPanel" rendered="#{GenericSurveySessionBean.showTanLogin}">
        <f:facet name="header">
        <center>Login</center>
        </f:facet>
        
        <table id="Tan_table" class="LoginTable">
        	<tr>
        		<td><h:outputText value="Tan-Nummer: " /> </td>
        		<td><h:inputSecret id="name_input" value="#{GenericSurveySessionBean.tan_nummer}"/></td>
        	</tr>
        	<tr>
        		<td><h:outputText value="Tan-Key " /> </td>
        		<td><h:inputSecret id="passwort_input" value="#{GenericSurveySessionBean.tan_key}"/></td>
        	</tr>
        	<tr>
        		<td colspan="2"><hr width="90%"/></td>
        	</tr>
        	<tr>
        		<td colspan="2">
        			<center>
        			<a4j:commandButton action="#{GenericSurveySessionBean.logInTan()}" value="Tan bestätigen" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();" execute="tan_form" render="Messagespopup,tan_form,login_form,umfrage_d_form"/>
        			</center>
        		</td>
        	</tr>
        </table>
	</rich:panel>
	</h:form>

	<h:form id="umfrage_d_form">
		<rich:panel style="border: 1px solid black; height: 600px; width: 500px; margin-right:auto;margin-left:auto;position:relative; top: 30px;" id="umfrage_panel" rendered="#{GenericSurveySessionBean.showLogin == false and GenericSurveySessionBean.showTanLogin == false}">
		<f:facet name="header"><center>Umfrage: <h:outputText value="#{GenericSurveySessionBean.survey.bezeichnung}"/></center></f:facet>
		<rich:extendedDataTable rowClass="rowstyle_umfrage" id="umfrage_d_table" style="width:400px;height:400px;margin-right:auto;margin-left:auto;" rows="1" frozenColumns="2" value="#{GenericSurveySessionBean.questionlistFromSurvey}" var="q">
			<rich:column rendered="#{q.typ != 'normal'}" width="400px">
				<f:facet name="header">Frage <h:outputText value="#{GenericSurveySessionBean.aktpage}"/></f:facet>
				<table>
					<tr>
						<td>Frage:</td>
						<td></td>
					</tr>
					<tr>
						<td colspan="2"><h:inputTextarea value="#{q.text}" readonly="true" cols="57" rows="3"/></td>
					</tr>
					<tr>
						<td><center><hr width="80%"/></center></td>
					</tr>
					<tr>
						<td>Antworten:</td>
						<td></td>
					</tr>
					<rich:dataGrid style="border:none;" columns="1" value="#{GenericSurveySessionBean.aktAnswerpossibilities}" var="ap">
						<h:column>
						<tr>
							<td colspan="2"><h:inputTextarea value="#{ap.answerpossibilty.text}" readonly="true" cols="57" rows="1"/></td>
						</tr>
						<tr>
							<td><h:selectBooleanCheckbox value="#{ap.selected}" /></td>
							<td></td>
						</tr>
						</h:column>
					</rich:dataGrid>
				</table>
			</rich:column>
			<rich:column width="400px">
				<f:facet name="header">Frage</f:facet>
				<table>
				<tr>
					<td>Frage</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="2"><h:inputTextarea value="#{q.text}" readonly="true" cols="57" rows="3"/></td>
				</tr>
				<tr>
					<td colspan="2"><center><hr width="80%"/></center></td>
				</tr>
				<tr>
					<td>Antwort:</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="2"><h:inputTextarea value="#{GenericSurveySessionBean.aktAnswer.ftAntwort}"  cols="57" rows="5"/></td>
				</tr>
				</table>
			</rich:column>
		</rich:extendedDataTable>
		<center><rich:dataScroller page="#{GenericSurveySessionBean.aktpage}"  id="u_datascroller" scrollListener="#{GenericSurveySessionBean.pageListener()}" execute="umfrage_d_form" render="umfrage_d_table" for="umfrage_d_table" maxPages="6"/></center>
		<center><hr width="80%"/></center>
		<center><h:commandButton onclick="#{rich:component('Loadingpopup')}.show();" value="Antworten speichern" action="#{GenericSurveySessionBean.saveAnswerSheet()}" execute="umfrage_d_form" render="login_form tan_form umfrage_d_form"/></center>
		</rich:panel>
	</h:form>
	
	<ui:include src="MessagesComp.xhtml"/>

	<ui:include src="LoadingBoxComp.xhtml"/>
	
	</h:body>
	</html>